<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>TalkJS clickable profile link tutorial</title>
    <link
      href="https://fonts.googleapis.com/css?family=Inter"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="/css/style.css" />
  </head>

  <body>
    <script>
      // prettier-ignore
      const { appId, currentUser } = JSON.parse('<%- config %>');
    </script>

    <div>
      <div id="users-list-container">
        <ul id="users-list">
          <% if (users) { %> <% Object.keys(users).forEach(key=> { %>
          <li
            onclick="initChat('<%=encodeURIComponent(JSON.stringify(users[key]))%>');"
          >
            <img
              src="<%= users[key].photoUrl %>"
              alt="<%= users[key].name %>'s photo"
            />
            <span> <%= users[key].name %> </span>
          </li>
          <% }); %> <% } %>
        </ul>
      </div>

      <div class="hidden" id="chatbox-container">
        <button>
          <a href="/">
            <!-- SVG left arrow icon -->
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="16"
              height="16"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-linecap="round"
              stroke-linejoin="round"
              stroke-width="2"
            >
              <path d="m15 18-6-6 6-6" fill="none" />
            </svg>
            Friends</a
          >
        </button>

        <div id="talkjs-container"></div>
      </div>
    </div>

    <script type="text/javascript" src="/js/script.js"></script>
  </body>
</html>
